package com.zhijiaoyun.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import com.zhijiaoyun.model.dto.PageList;
import org.springframework.stereotype.Service;

import com.zhijiaoyun.common.ResponseUtils;
import com.zhijiaoyun.dao.IBannerDao;
import com.zhijiaoyun.model.Banner;
import com.zhijiaoyun.service.IBannerService;

/**
 * @author shisfish
 * @date 2017/6/6
 */
@Service(value = "bannerService")
public class BannerServiceImpl implements IBannerService {

	@Resource
	IBannerDao bannerDao;
	
	@Override
	public List<Banner> getByParams(String title, Integer bannerType) {
		return bannerDao.getByParams(title, bannerType);
	}

	@Override
	public void deleteBanner(Banner banner) {
		bannerDao.deleteByPrimaryKey(banner.getBannerId());
	}

	@Override
	public Banner getBannerByTitleNotBannerId(Long bannerId, String title) {
		return null;
	}

	@Override
	public void modifyBanner(Banner banner) {
		bannerDao.updateByPrimaryKey(banner);
	}

	@Override
	public void addBanner(Banner banner) {
		bannerDao.insert(banner);
	}

	@Override
	public Map<String, Object> listByParams(String title, Integer bannerType) {
		List<Banner> banners = getByParams(title, bannerType);
		Map<String, Object> map = new HashMap<>();
		map.put("list", banners);
		return ResponseUtils.responseSuccessMap(map);
	}

	@Override
	public void insert(Banner banner) {

	}

	@Override
	public void update(Banner banner) {

	}

	@Override
	public void delete(Banner banner) {

	}

	@Override
	public void deleteById(long id) {

	}

	@Override
	public Banner getById(long id) {
		return bannerDao.selectByPrimaryKey(id);
	}

	@Override
	public PageList<Banner> page(int pageIndex, int pageSize, Object... args) {
		return null;
	}
}
